package com.java.main.domain.IdEntity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import com.java.main.domain.KbmContent;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 自动增长ID对象父类
 * 
 */
@ApiModel
@MappedSuperclass
@EntityListeners({ IdEntityAutoListener.class })
public abstract class IdEntityAuto implements Serializable {

	private static final long serialVersionUID = 1L;

	/** 自增主键 */
	@ApiModelProperty("主键ID")
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;

	/** 创建时间 */
	@ApiModelProperty(hidden = true)
	private Date createTime;

	/** 修改时间 */
	@ApiModelProperty(hidden = true)
	private Date modifyTime;

	/** 删除标识 */
	@ApiModelProperty(hidden = true)
	@Column(nullable = false, length = 1)
	private Integer softDelete;

	/** 地方中心 */
	@ApiModelProperty(hidden = true)
	@Column(nullable = false, length = 10)
	private Integer endemicId;

	/** 创建人 */
	@ApiModelProperty(hidden = true)
	@Column(nullable = false, length = 10)
	private Integer createId;

	/** 修改人 */
	@ApiModelProperty(hidden = true)
	@Column(length = 10)
	private Integer modifiyId;

	@Transient
	@ApiModelProperty(hidden = true)
	private KbmContent kbmContent;

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		IdEntityAuto other = (IdEntityAuto) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public String toString() {
		return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}

	public KbmContent getKbmContent() {
		return kbmContent;
	}

	public void setKbmContent(KbmContent kbmContent) {
		this.kbmContent = kbmContent;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getEndemicId() {
		return endemicId;
	}

	public void setEndemicId(Integer endemicId) {
		this.endemicId = endemicId;
	}

	public Integer getCreateId() {
		return createId;
	}

	public void setCreateId(Integer createId) {
		this.createId = createId;
	}

	public Integer getModifiyId() {
		return modifiyId;
	}

	public void setModifiyId(Integer modifiyId) {
		this.modifiyId = modifiyId;
	}

	public Integer getSoftDelete() {
		return softDelete;
	}

	public void setSoftDelete(Integer softDelete) {
		this.softDelete = softDelete;
	}

}
